package com.huffman.smart_picture.domain.enums;

import com.huffman.smart_picture.domain.constants.CommonConstant;
import lombok.Getter;

@Getter
public enum VipDurationTimeEnum {

    DAY(1, CommonConstant.ONE_DAY),
    MONTH(2, CommonConstant.ONE_MONTH),
    YEAR(3, CommonConstant.ONE_YEAR);

    private final Integer value;

    private final Long timeUnit;


    VipDurationTimeEnum(Integer value, Long timeUnit) {
        this.value = value;
        this.timeUnit = timeUnit;
    }

    public static VipDurationTimeEnum getEnumByValue(Integer value) {
        if (value == null) {
            return null;
        }

        for (VipDurationTimeEnum vipDurationTimeEnum : values()) {
            if (vipDurationTimeEnum.value.equals(value)) {
                return vipDurationTimeEnum;
            }
        }
        return null;
    }

}
